<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">

    <title>首页</title>

    <meta content="width=device-width,initial-scale=1.0,minimum-scale=1.0.maximum-scale=1.0,user-scalable=no" name="viewport">

    <script src="js/flexible.js"></script>

    <link rel="stylesheet" href="css/reset.css">

    <link rel="stylesheet" href="css/homePage.css">

    <link rel="stylesheet" href="css/flexible.css">

    <link rel="stylesheet" href="css/vant.css">

    <script src="js/jquery-3.3.1.min.js"></script>

    <script src="js/vue.js"></script>

    <script src="js/axios.js"></script>

    <script src="js/MD5.js"></script>

    <script src="js/vant.js"></script>

</head>

<body>

<div class="container_box" id="app">

    <template>

        <header>

            <ul>

                <li>我的会员</li>

                <!-- <li><a href="addMember.html">添加会员</a></li> -->

                <li class="rf">

                    <img @click="logo" src="images/logo.png" class="quit">

                    <div class="logo" v-show='logoShow'>

                        <p><a href="editPass.html">修改密码</a></p>

                        <p><a href="#" @click="signOut">退出登录</a></p>

                    </div>

                </li>

            </ul>

        </header>

        <div class="fitness_location">

          <ul class="first">

              <li @click="allSearch(1,1)">

                  <p>全部会员</p>

                  <p class="all_kh">{{myFrom.allCustomer}}</p>

              </li>

              <li @click="allSearch('moonuser',1)">

                  <p>本月新增</p>

                  <p class="add_xz">{{myFrom.newlyAdded}}</p>

              </li>

          </ul>

            <ul class="two">

                <li @click="allSearch('neveruer',1)">

                    <p>从未跟进</p>

                    <p class="two_cw">{{myFrom.followUp}}</p>

                </li>

                <li @click="allSearch('dayuser',1)">

                    <p>今日跟进</p>

                    <p class="today_gj">{{myFrom.todayFollowUp}}</p>

                </li>

            </ul>

        </div>

        <header>

            <ul>

                <li>我的客户</li>

                <li><a href="customer.html">添加访客</a></li>

            </ul>

        </header>

        <div class="fitness_location">

            <ul class="first">

                <li @click="allSearch(1,0)">

                    <p>全部客户</p>

                    <p class="all_kh">{{from.allCustomer}}</p>

                </li>

                <li @click="allSearch('moonuser',0)">

                    <p>本月新增</p>

                    <p class="add_xz">{{from.newlyAdded}}</p>

                </li>

            </ul>

            <ul class="two">

                <li @click="sale('befor')">

                    <p>上月销售额(元)</p>

                    <p class="two_cw">{{from.followUp}}</p>

                </li>

                <li @click="sale('1')">

                    <p>本月销售额(元)</p>

                    <p class="today_gj">{{from.todayFollowUp}}</p>

                </li>

            </ul>

        </div>

        <p class="membership_card">售卖会员卡</p>

        <div class="card_sales" v-for="item in cardList" :key=item.id @click="guy(item.id)">

            <div class="card_sales_year clearfix">

                <div class="lf mem_card">

                    <img v-if="item.Cardtype=='10'" :src="url" class="hui_card">

                    <img v-else-if="item.Cardtype=='20'" :src="url1" class="hui_card">

                    <img v-else :src="url2" class="hui_card">

                </div>

               <div class="lf width70">

                   <p class="card_year">{{item.Cardname}}</p>

                   <p class="card_day"><span>巨惠价</span><span>￥{{item.Charge}}</span></p>

                   <!-- <p class="card_money fr">推荐朋友</p> -->

               </div>

            </div>

        </div>

    </template>

</div>

</body>

<script>

    new Vue({

        el: '#app',

        data: {

                logoShow:false,

                url:'images/qixiancard.png',

                url1:'images/cishucard.png',

                url2:'images/chuzhicard.png',

                myFrom:{

                    allCustomer:'',

                    newlyAdded:'',

                    followUp:'',

                    todayFollowUp:''

                },

                from:{

                    allCustomer:'',

                    newlyAdded:'',

                    followUp:'',

                    todayFollowUp:''

                },

                cardList:[]

            },

            created(){

                this.getList()

            },

            methods:{

                getVs(){

                    let timestamp= parseInt(new Date().getTime()/1000)+"Z1i2H3a4i5Y6u7n8G9u0a1n2J3i4a5#BeiJing.091014:16";

                    let Verification = md5(timestamp);

                    sessionStorage.setItem('Verification',Verification)

                },

                getList(){

                    this.getVs()

                    sessionStorage.setItem('logo','0')

                    axios.post('/mobileapi/adviser/index.php').then(data =>{

                        console.log(data)

                        let { msg, code,user} = data.data

                            if (code !== 200) {

                                window.vant.Toast.fail(msg)

                            } else {

                                data=data.data

                                this.cardList=data.data.cardlist

                                this.myFrom.allCustomer=data.data.alluser

                                this.myFrom.newlyAdded=data.data.moonuser

                                this.myFrom.followUp=data.data.neveruer

                                this.myFrom.todayFollowUp=data.data.dayuser

                                this.from.allCustomer=data.data.allcustom

                                this.from.newlyAdded=data.data.mooncustom

                                this.from.followUp=data.data.lsales

                                this.from.todayFollowUp=data.data.osales

                            }

                        }).catch(function (error) {

                            console.log(error);

                    });

                },

                logo(){

                    this.logoShow=!this.logoShow

                },

                //跳转到会员页面

                allSearch(type,state){

                    console.log(type)

                    console.log(state)

                    if(type=='1'&&state=='1'){

                        type=''

                    }

                    window.location.href='myMember.html?type='+type+'&state='+state+''

                },

                //销售页面

                sale(type){

                   if(type=='befor'){

                     window.location.href='beforSale.html?type='+type+''

                   }else{

                    window.location.href='bsale.html?type='+type+''

                   }

                },

                //退出登录

                signOut(){

                     let vidTc=sessionStorage.getItem('vid')

                    sessionStorage.clear()

                    localStorage.removeItem('adviserTime')

                    localStorage.removeItem('adviser')

                    localStorage.removeItem('adviserGtoken')

                    localStorage.removeItem('adviservid')

                    window.location.href='login.html?vid='+vidTc+''

                },

                //跳转到会员端的会员卡详情

                guy(id){

window.location.href='https://fitness.guanjialc.com/phone/member/membercard_detail.html?csid='+id+'&fromal=adviser&vid='+sessionStorage.getItem('vid')+''

                }

            }

        })

</script>

</html>

